package org.example.buysystem.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.buysystem.common.Result;
import org.example.buysystem.entity.Carousel;
import org.example.buysystem.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RequestMapping("/api/carousel")
@RestController
@CrossOrigin
@Api(value = "轮播图模块",tags = {"轮播图模块"})
public class CarouselController {
    @Autowired
    private CarouselService carouselService;

    @GetMapping()
    @ApiOperation("获取轮播图列表")
    public Result findAll(){
        List<Carousel> carousels = carouselService.getAll();
        return Result.success(carousels);
    }



}
